from django.shortcuts import render

# Create your views here.
from rest_framework.generics import ListAPIView
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.status import HTTP_200_OK
from django_redis import get_redis_connection

from views import CacheListAPIView
from .models import Nav
from constants import *
from .serializers import *

class NavHeaderListAPIView(CacheListAPIView):
    queryset = Nav.objects.filter(position=NAV_HEADER_POSITION,is_deleted=False, is_show=True).order_by('orders', '-id')[:NAV_HEADER_SIZE]
    serializer_class = NavModelSerializer

class NavFooterListAPIView(CacheListAPIView):
    queryset = Nav.objects.filter(position=NAV_FOOTER_POSITION, is_deleted=False, is_show=True).order_by('orders','-id')[:NAV_FOOTER_SIZE]
    serializer_class = NavModelSerializer


class BannerListAPIView(CacheListAPIView):
    queryset = Banner.objects.filter(is_deleted=False, is_show=True).order_by('orders','-id')[:BANNER_SIZE]
    serializer_class = BannerModelSerializer

